package com.heyqing.topic.FindDisappearedNumbers_0448;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * ClassName:FindDisappearedNumbers
 * Package:com.heyqing.topic.FindDisappearedNumbers_0448
 * Description:
 *
 * @Date:2024/9/30
 * @Author:Heyqing
 */
public class FindDisappearedNumbers {
    public List<Integer> findDisappearedNumbers(int[] nums) {
        int n = nums.length;
        for (int num : nums) {
            int x = (num - 1) % n;
            nums[x] += n;
        }
        List<Integer> ret = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            if (nums[i] <= n) {
                ret.add(i + 1);
            }
        }
        return ret;
    }
}
